package roborally.script;

import java.util.ArrayList;
import java.util.List;

import roborally.model.Robot;
import be.kuleuven.cs.som.annotate.*;
import be.kuleuven.cs.som.taglet.*;

/**
 * @author Joren VERSPEURT
 * @author Mathieu REYMOND
 * @version 3.0
 * 
 * The superclass for all composed commands possible in RoboRally. This includes ConditionalCommand and NonConditionalCommand.
 */
public abstract class ComposedCommand extends Command {
	
	/**
	 * Create a new ComposedCommand with a given Robot and a number of sub-Commands.
	 * @param robot The Robot this Command will apply to.
	 * @param commands The Commands this ComposedCommand will be composed of.
	 */
	protected ComposedCommand(Robot robot, Command... commands){
		super(robot);
		this.commands = new ArrayList<Command>();
		for(Command command : commands){
			this.commands.add(command);
		}
	}
	
	/**
	 * The list of Commands this ComposedCommand is composed of.
	 */
	protected final List<Command> commands;
	
	/**
	 * Returns the list of Commands this ComposedCommand is composed of.
	 */
	@Basic @Immutable
	protected List<Command> getCommands() {
		return commands;
	}

}
